package net.sudot.commons.security;

import net.sudot.chess.business.model.SocialUser;
import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * 社会化用户认证令牌
 *
 * @author tangjialin on 2018-03-15.
 */
public class SocialUserAuthenticationToken extends UsernamePasswordToken {

    /** 社会化用户 */
    private SocialUser socialUser;

    /**
     * 构造方法
     *
     * @param socialUser 社会化用户
     * @param rememberMe 记住我
     * @param host       登录IP
     */
    public SocialUserAuthenticationToken(SocialUser socialUser, boolean rememberMe, String host) {
        super(String.format("%s:%s", socialUser.getLoginPluginId(), socialUser.getUniqueId()), new char[0], rememberMe, host);
        this.socialUser = socialUser;
    }

    /**
     * 获取社会化用户
     *
     * @return 社会化用户
     */
    public SocialUser getSocialUser() {
        return socialUser;
    }

}